package com.uama.plugin.definitionsearch;

import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiTypeParameterListOwner;
import com.intellij.util.Processor;
import com.uama.plugin.service.MyJavaService;
import org.jetbrains.annotations.NotNull;


/**
 * @author shangzhen.xie
 */
public class MyDefinitionSearch extends QueryExecutorBase<PsiMethod, PsiElement> {

    public MyDefinitionSearch() {
        super(true);
    }

    @Override
    public void processQuery(@NotNull PsiElement element, @NotNull Processor<? super PsiMethod> processor) {
        if (!(element instanceof PsiTypeParameterListOwner)) return;

        if (element instanceof PsiMethod) {
            PsiMethod psiMethod = (PsiMethod) element;
            MyJavaService.getInstance(element.getProject()).process(psiMethod, processor);
        }
    }

}
